$(function() {
    $(".numStatistics > div").click(function() {
        if ($(this).attr('id') != "zoom") {
            $(this).addClass('actionClick').siblings().removeClass('actionClick')
        }
    });
    $(".numStatistics > div").eq(0).click();
    $(".timeButton > .buttonBox button").click(function() {
        $(this).css('border', '1px solid #ff7e00').siblings().css('border', '1px solid #cccccc')
    });
    screenTable = function() {
        var menuName = $("#menuName").val();
        var index = layer.open({
            type: 2,
            title: '表格筛选',
            area: ['70%', '60%'],
            fix: true,
            maxmin: true,
            content: Feng.ctxPath + '/reservation/reservation_screenTable/' + menuName
        });
        this.layerIndex = index
    };
    displayHiding = function(obj) {
        if ($("#zoom > span").hasClass('tabMark')) {
            $("#zoom > span").removeClass('tabMark').html('条件展开');
            $("#zoom > img,.divFlex").toggle();
            $(document).ready(function() {
                $('#' + obj).bootstrapTable('resetView', {
                    height: $(window).height() - 76
                })
            })
        } else {
            $("#zoom > span").addClass('tabMark').html('条件收起');
            $("#zoom > img,.divFlex").toggle();
            $(document).ready(function() {
                $('#' + obj).bootstrapTable('resetView', {
                    height: $(window).height() - 137
                })
            })
        }
    };
    setDateTime = function(time, obj) {
        var date = time;
        date.setDate(date.getDate() - obj);
        var currentYear = date.getFullYear();
        var currentMonth = date.getMonth() + 1;
        var currentDay = date.getDate();
        if (currentMonth < 10) currentMonth = "0" + currentMonth;
        if (currentDay < 10) currentDay = "0" + currentDay;
        return currentYear + "-" + currentMonth + "-" + currentDay
    };
    setMonthTime = function(time, obj) {
        var date = time;
        date.setMonth(date.getMonth() - obj, 1);
        var currentYear = date.getFullYear();
        var currentMonth = date.getMonth() + 1;
        var day = new Date(currentYear, currentMonth, 0);
        var currentDay = day.getDate();
        if (currentMonth < 10) currentMonth = "0" + currentMonth;
        if (currentDay < 10) currentDay = "0" + currentDay;
        return currentYear + "-" + currentMonth + "-" + currentDay
    };
    firstMonthTime = function(time, obj) {
        var date = time;
        date.setMonth(date.getMonth() - obj, 1);
        var currentYear = date.getFullYear();
        var currentMonth = date.getMonth() + 1;
        if (currentMonth < 10) currentMonth = "0" + currentMonth;
        return currentYear + "-" + currentMonth + "-01"
    };
    multipleSelection = function(obj) {
        var unknownValue = "";
        if (obj != null && obj != "" && obj != undefined) {
            for (var i = 0; i < obj.length; i++) {
                if (i == (obj.length - 1)) {
                    unknownValue += obj[i]
                } else {
                    unknownValue += obj[i] + ","
                }
            }
        }
        return unknownValue
    };
    menuNameHideColumn = function(menuName, obj) {
        $.ajax({
            url: Feng.ctxPath + "/reservation/reservation_initialization",
            type: "post",
            data: {
                "menuName": menuName
            },
            success: function(data) {
                if (data != "") {
                    var item = data.split("，");
                    for (var i = 0; i < item.length; i++) {
                        $('#' + obj).bootstrapTable('hideColumn', item[i])
                    }
                }
            }
        })
    }
});